package com.apes.fn.server.servicePlan.repository;

import com.apes.fn.crm.customerExpand.FnCustomerExpand;
import com.apes.fn.server.servicePlan.model.ServicePlan;
import com.apes.framework.jpa.repository.CustomRepository;
import com.apes.scm.account.account.model.Stock;
import com.apes.scm.masterdata.frame.model.Dept;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.Date;
import java.util.List;

/**
 * 方案和库存的符合查询类
 * param:zyc
 **/
public interface StockForPlanRepository extends CustomRepository<Stock, String> {
    @Query("SELECT T FROM Stock T LEFT JOIN ServicePlanItem  Y ON T.product.id = Y.product.id AND T.location.id = Y.location.id " +
            "WHERE Y.id in :idList and T.usableQty > 0 ")
    List<Stock> findByLocationAndProduct(@Param("idList") List id);
}
